﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EntidadesCompartidas;

namespace Smart_House_System
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        private Usuario x;
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                x = (Usuario)Session["Usuario"];
                if (x == null || x.ElRol != RolUsuario.administrador)
                    Response.Redirect("~/loggueo.aspx");
            }
            catch
            {
                Response.Redirect("~/loggueo.aspx");
            }
        }

        protected void lnkCerrarSesion_Click(object sender, EventArgs e)
        {
            Session["Usuario"] = null;
            Response.Redirect("~/loggueo.aspx");
        }
    }
}
